{{define "form/streamTCP"}}
<!-- tcp type -->
<a-form layout="inline">
    <a-form-item label="acceptProxyProtocol">
        <a-switch v-model="inbound.stream.tcp.acceptProxyProtocol"></a-switch>
    </a-form-item>
    <a-form-item label="http 伪装">
        <a-switch
                :checked="inbound.stream.tcp.type === 'http'"
                @change="checked => inbound.stream.tcp.type = checked ? 'http' : 'none'">
        </a-switch>
    </a-form-item>
</a-form>

<!-- tcp request -->
<a-form v-if="inbound.stream.tcp.type === 'http'"
        layout="inline">
    <a-form-item label="请求版本">
        <a-input v-model.trim="inbound.stream.tcp.request.version"></a-input>
    </a-form-item>
    <a-form-item label="请求方法">
        <a-input v-model.trim="inbound.stream.tcp.request.method"></a-input>
    </a-form-item>
    <a-form-item label="请求路径">
        <a-row v-for="(path, index) in inbound.stream.tcp.request.path">
            <a-input v-model.trim="inbound.stream.tcp.request.path[index]"></a-input>
        </a-row>
    </a-form-item>
    <a-form-item label="请求头">
        <a-row>
            <a-button size="small"
                      @click="inbound.stream.tcp.request.addHeader('Host', 'xxx.com')">
                +
            </a-button>
        </a-row>
        <a-input-group v-for="(header, index) in inbound.stream.tcp.request.headers">
            <a-input style="width: 50%" v-model.trim="header.name"
                     addon-before="名称"></a-input>
            <a-input style="width: 50%" v-model.trim="header.value"
                     addon-before="值">
                <template slot="addonAfter">
                    <a-button size="small"
                              @click="inbound.stream.tcp.request.removeHeader(index)">
                        -
                    </a-button>
                </template>
            </a-input>
        </a-input-group>
    </a-form-item>
</a-form>

<!-- tcp response -->
<a-form v-if="inbound.stream.tcp.type === 'http'"
        layout="inline">
    <a-form-item label="响应版本">
        <a-input v-model.trim="inbound.stream.tcp.response.version"></a-input>
    </a-form-item>
    <a-form-item label="响应状态">
        <a-input v-model.trim="inbound.stream.tcp.response.status"></a-input>
    </a-form-item>
    <a-form-item label="响应状态说明">
        <a-input v-model.trim="inbound.stream.tcp.response.reason"></a-input>
    </a-form-item>
    <a-form-item label="响应头">
        <a-row>
            <a-button size="small"
                      @click="inbound.stream.tcp.response.addHeader('Content-Type', 'application/octet-stream')">
                +
            </a-button>
        </a-row>
        <a-input-group v-for="(header, index) in inbound.stream.tcp.response.headers">
            <a-input style="width: 50%" v-model.trim="header.name"
                     addon-before="名称"></a-input>
            <a-input style="width: 50%" v-model.trim="header.value"
                     addon-before="值">
                <template slot="addonAfter">
                    <a-button size="small"
                              @click="inbound.stream.tcp.response.removeHeader(index)">
                        -
                    </a-button>
                </template>
            </a-input>
        </a-input-group>
    </a-form-item>
</a-form>
{{end}}